package com.sanyu.controller.repairman;

import com.sanyu.pojo.dto.RepairRecordDTO;
import com.sanyu.pojo.dto.RepairRecordPageQueryDTO;
import com.sanyu.pojo.vo.RepairRecordVO;
import com.sanyu.pojo.vo.WorkRecordVO;
import com.sanyu.result.PageResult;
import com.sanyu.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("/repairRecord")
@Api("维修APP/报修记录(派单)相关接口")
public class RepairRecordController {

    @PostMapping("/accept/{id}")
    @ApiOperation("根据ID接单")
    public Result accept(@PathVariable Long id){
        return Result.success();
    }

    @PutMapping("/submit")
    @ApiOperation("提交派单至审核")
    public Result submit(@RequestBody RepairRecordDTO repairRecordDTO){
        return Result.success();
    }

    @GetMapping("/{id}")
    @ApiOperation("根据派单ID获取所有从属工单ID")
    public Result<List<WorkRecordVO>> getWorkRecordsById(){
        List<WorkRecordVO> workRecordVOList = new ArrayList<>();
        return Result.success(workRecordVOList);
    }

    @GetMapping("/{id}")
    @ApiOperation("根据ID查询派单")
    public Result<RepairRecordVO> detail(@PathVariable Long id){
        RepairRecordVO repairRecordVO = new RepairRecordVO();
        return Result.success(repairRecordVO);
    }

    @GetMapping("/page")
    @ApiOperation("分页查询报修记录")
    public Result<PageResult> page(RepairRecordPageQueryDTO repairRecordPageQueryDTO){
        return Result.success(new PageResult());
    }

    @GetMapping("/daySum")
    @ApiOperation("查看今日完成派单统计")
    public Result<Integer> daySum(){
        return Result.success(0);
    }

    @GetMapping("/monthSum")
    @ApiOperation("查看本月完成派单统计")
    public Result<Integer> monthSum(){
        return Result.success(0);
    }

    @PostMapping("/add")
    @ApiOperation("运维报修")
    public Result add(@RequestBody RepairRecordDTO repairRecordDTO){
        return Result.success();
    }
}
